package com.tchepannou.limbe.mock.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import java.util.Enumeration;
import java.util.Properties;

public class MockServletConfig
    implements ServletConfig
{
    private String _name ;
    private ServletContext _context;
    private Properties _params;
    
    public MockServletConfig (String name, ServletContext ctx)
    {
        _name = name;
        _context = ctx;
        _params = new Properties ();
    }
    
    @Override
    public String getServletName()
    {
        return _name;
    }

    @Override
    public ServletContext getServletContext()
    {
        return _context;
    }

    @Override
    public String getInitParameter(String name)
    {
        return _params.getProperty(name);
    }

    @Override
    public Enumeration getInitParameterNames()
    {
        return _params.propertyNames();
    }
    
    public void setInitParameter (String name, String value)
    {
        _params.setProperty(name, value);
    }

}
